package com.cpl.presentation.springMvcSample;
import org.springframework.stereotype.Controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cpl.facade.springMvcSample.IRegistrationFacade;

@Controller
public class RegistrationActionController {
	
    @Autowired
    private IRegistrationFacade regFacade;
    
    @RequestMapping(value="/register")
    public ModelAndView register(HttpServletRequest request) {
        // Handle a new guest (if any):
       /* String name = request.getParameter("name");
        String age=request.getParameter("age");*/
    	String name="name";
    	String age="age";
        
        if(name !=null && age != null)
        	regFacade.register(name,age);
 
        // Prepare the result view (guest.jsp):
        return new ModelAndView("success");
    }
}
